package main

import "fmt"

/**
 * @author: guangcheng
 * @date:   2020/11/20 14:57
 * @version  V1.0
 * @description:
 *
 */
func main() {
	var p1 Student
	p1.Age = 10
	p1.Name = "小明"

	var p2 *Student = &p1
	fmt.Println((*p2).Age)
	fmt.Println(p2.Age)

	p2.Name = "tomcat~~"
	/**
	p2.Name=tomcat~~ p1.Name=tomcat~~
	p2.Name=tomcat~~ p1.Name=tomcat~~
	*/
	fmt.Printf("p2.Name=%v p1.Name=%v \n", p2.Name, p1.Name)
	fmt.Printf("p2.Name=%v p1.Name=%v \n", (*p2).Name, p1.Name)

	//内存地址探寻
	//p1address=0xc000098420 p2address=0xc0000cc018 p1={tomcat~~ 10} p2=&{tomcat~~ 10}
	fmt.Printf("p1address=%p p2address=%p p1=%v p2=%v", &p1, &p2, p1, p2)
}

type Student struct {
	Name string
	Age  int
}
